#pragma once

#include "Object/Object.h"
#include "Widgets/Widget.h"





//manage selection of a group widget
class WHENGINE_API  CMouseSelectionGroup 
{
public:          
    //which button trigger selection
    EMouseButton MouseButton=EMouseButton::Left; 

    //use double click to trigger select ?
    bool DoubleClick=false;  

    

    // what will happen when select widget
    TDelegate<void, RWidgetWeakPtr /*widget To Select */> OnWidgetSelected;

    //what will happen on selected widget when unselect
    TDelegate< void, RWidgetWeakPtr /*Selected widget*/ > OnWidgetUnselected;

    void Select(RWidgetWeakPtr WidgetToSelect);

    void Unselect();

    TDelegate<void> OnSelectionChanged;

    RWidgetWeakPtr GetSelectedWidget();
protected:
    RWidgetWeakPtr SelectedWidget;
};

class WHENGINE_API CMouseSelectionGroupItem
{
public:
    CMouseSelectionGroupItem(RWidgetWeakPtr InSelectTarget,std::shared_ptr<CMouseSelectionGroup> InGroup);

    // which widget you want to select
    RWidgetWeakPtr SelectTarget;

    std::shared_ptr<CMouseSelectionGroup> Group;
};